/// 分享响应模型
/// 对应MyApplication2项目中的SharedBean结构
class ShareResponse {
  /// 响应状态
  final String status;
  
  /// 响应消息
  final String? message;
  
  /// 分享数据
  final ShareData? data;

  ShareResponse({
    required this.status,
    this.message,
    this.data,
  });

  /// 是否成功
  bool get isSuccess => status == 'success';

  /// 转换为JSON
  Map<String, dynamic> toJson() {
    return {
      'status': status,
      'message': message,
      'data': data?.toJson(),
    };
  }

  /// 从JSON创建
  factory ShareResponse.fromJson(Map<String, dynamic> json) {
    return ShareResponse(
      status: json['status'] ?? 'error',
      message: json['message'],
      data: json['data'] != null ? ShareData.fromJson(json['data']) : null,
    );
  }

  @override
  String toString() {
    return 'ShareResponse(status: $status, message: $message, data: $data)';
  }
}

/// 分享数据模型
/// 对应MyApplication2项目中的SharedBean.DataDTO结构
class ShareData {
  /// 分享ID
  final int? shareId;
  
  /// 分享URL
  final String shareUrl;

  ShareData({
    this.shareId,
    required this.shareUrl,
  });

  /// 转换为JSON
  Map<String, dynamic> toJson() {
    return {
      'shareId': shareId,
      'shareUrl': shareUrl,
    };
  }

  /// 从JSON创建
  factory ShareData.fromJson(Map<String, dynamic> json) {
    return ShareData(
      shareId: json['shareId'],
      shareUrl: json['shareUrl'] ?? '',
    );
  }

  @override
  String toString() {
    return 'ShareData(shareId: $shareId, shareUrl: $shareUrl)';
  }
}
